Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
prosemirror-commands
Advanced tools
The prosemirror-commands package provides a set of predefined commands for manipulating the content of a ProseMirror editor. These commands cover a wide range of common editing actions, such as formatting text, inserting nodes, and manipulating the document structure.
Text Formatting
This feature allows you to toggle text formatting such as bold, italic, and underline. The code sample demonstrates how to create a command to toggle bold formatting using the ProseMirror schema.
const { toggleMark } = require('prosemirror-commands');
const { schema } = require('prosemirror-schema-basic');
// Example command to toggle bold formatting
const toggleBold = toggleMark(schema.marks.strong);
Node Insertion
This feature allows you to insert or change the type of nodes in the document. The code sample shows how to create a command to set a block type to a paragraph.
const { setBlockType } = require('prosemirror-commands');
const { schema } = require('prosemirror-schema-basic');
// Example command to set a paragraph block type
const setParagraph = setBlockType(schema.nodes.paragraph);
Document Manipulation
This feature provides commands for manipulating the document structure, such as joining blocks or splitting nodes. The code sample demonstrates how to create a command to join the current block with the one above it.
const { joinUp } = require('prosemirror-commands');
// Example command to join the current block with the one above it
const joinWithAbove = joinUp;
Tiptap is a headless, framework-agnostic text editor built on top of ProseMirror. It provides a more modern and flexible API for creating rich text editors. Compared to prosemirror-commands, Tiptap offers a higher-level abstraction and additional features like collaborative editing and real-time collaboration.
Slate is a completely customizable framework for building rich text editors. It provides a more flexible and extensible API compared to prosemirror-commands, allowing developers to define their own commands and behaviors. Slate is known for its ease of use and powerful plugin system.
Draft.js is a rich text editor framework developed by Facebook. It provides a set of immutable models and helper functions for building rich text editors. While it offers similar functionalities to prosemirror-commands, Draft.js is more opinionated and tightly integrated with React.
[ WEBSITE | ISSUES | FORUM | CHANGELOG ]
This is a core module of ProseMirror. ProseMirror is a well-behaved rich semantic content editor based on contentEditable, with support for collaborative editing and custom document schemas.
This module implements a number of editing commands, which are functions that abstract editing actions which can be bound to keys.
The project page has more information, a number of examples and the documentation.
This code is released under an MIT license. There's a forum for general discussion and support requests, and the Github bug tracker is the place to report issues.
We aim to be an inclusive, welcoming community. To make that explicit, we have a code of conduct that applies to communication around the project.
1.6.2 (2024-10-24)
Make splitBlock
smart enough to split blocks when the cursor is inside a nested inline node.
FAQs
Editing commands for ProseMirror
The npm package prosemirror-commands receives a total of 1,351,378 weekly downloads. As such, prosemirror-commands popularity was classified as popular.
We found that prosemirror-commands demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.